<template>
  <div class="assessmentReport">
    <c-title :hide="false" text="测评报告"></c-title>
    <div class="contenBox">
      <div class="reportTitle">{{ contenHtml.name }}</div>
      <div v-html="contenHtml.result" id="shopInfo"></div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      contenHtml: "",
    };
  },
  activated() {
    this.getData();
  },
  beforeRouteLeave(to, from, next) {
    console.log(to, from, "dddddddddddd");
    if (to.name == "orderpay" || to.name == "payBack") {
      if (from.params.view) {
        this.$router.go(-1);
      } else {
        this.$router.push(this.fun.getUrl("assessmentIndex", {}));
      }
      next(false);
    } else {
      next();
    }
  },
  methods: {
    // backDiyURL() {
    //   if (this.$route.params.view) {
    //     // 返回上一页
    //     this.$router.go(-1);
    //     return;
    //   } else {
    //     this.$router.replace(this.fun.getUrl("assessmentIndex", {}));
    //     return;
    //   }
    // },
    getData() {
      $http
        .post("plugin.assessment.frontend.question.resultDetail", { id: this.$route.params.id }, "")
        .then(response => {
          if (response.result === 1) {
            this.contenHtml = response.data.result;
          } else {
            this.$toast(response.msg);
          }
        })
        .catch(error => {
          console.log(error);
        });
    }
  }
};
</script>
<style lang="scss" scoped>
.contenBox {
  padding: 0.94rem;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 100vh;
  background: #ffffff;
  .reportTitle {
    background: #ffffff;
    text-align: left;
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1.25rem;
  }
}
</style>
